<template>
  <div>
    <el-table
      :data="
        tableData.filter(
          (data) =>
            !search || data.name.toLowerCase().includes(search.toLowerCase())
        )
      "
      style="width: 100%; height: 100%"
    >
      <el-table-column type="selection" width="55"> </el-table-column>
      <el-table-column prop="date" label="日期" width="180"> </el-table-column>
      <el-table-column prop="name" label="姓名" width="180"> </el-table-column>
      <el-table-column prop="address" label="科室"> </el-table-column>
      <el-table-column prop="doctor" label="医生"> </el-table-column>
    <el-table-column prop="pay" label="支付状态"></el-table-column>
   
      <el-table-column label="" align="right">
        <template slot="header">
          <el-input v-model="search" size="mini" placeholder="输入关键字搜索" />
        </template>
          <template slot-scope="scope">
        <el-button
          size="mini"
          @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
        <el-button
          size="mini"
          type="danger"
          @click="handleDelete(scope.$index, scope.row)">删除</el-button>
      </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  data() {
    return {
      search: '',
      tableData: [
        {
          date: "2016-05-03",
          name: "王小虎",
          doctor: "刘医生",
          address: "核酸检测",
          pay: '未支付',
        },
        {
          date: "2019-06-03",
          name: "刘娜",
          doctor: "赵医生",
          address: "核酸检测",
          pay: '未支付',
        },
      ],
    };
  },
  methods: {
   handleDelete(index, row) {
        console.log(index, row.name); 
        this.$notify({
          title: '操作',
          message:('i', { style: 'color: teal'}, `您进行了一次删除操作 删除用户为${row.name}`),
        });
         
      }
  },
};
</script>

<style lang="scss" scoped>
</style>